home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / pine / osdep / codepage.win < prev    next >
Text File  |  1996-06-06  |  4KB  |  94 lines

  1. #line 2 "osdep/codepage.win"
  2.  
  3.  
  4. /*----------------------------------------------------------------------
  5.     Translation tables to map Windows codepages to ISO-8859-1 charsets
  6.     and back.
  7.   ----------------------------------------------------------------------*/
  8. #ifdef    notdef
  9. /* NOTE: this isn't used right now */
  10. /*
  11.  * Map from ISO 8859-2 Latin-2 to Windows Code Page 1250
  12.  */
  13. unsigned char L2cp1250[] = {
  14.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  15.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  16.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  17.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  18.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  19.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  20.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  21. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  22. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
  23. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
  24. 160, 165, 162, 163, 164, 188, 140, 167, 168, 138, 170, 141, 143, 173, 142, 175,
  25. 176, 185, 178, 179, 180, 190, 156, 161, 184, 154, 186, 157, 159, 189, 158, 191,
  26. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  27. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  28. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  29. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  30. };
  31.  
  32.  
  33. /* NOTE: this isn't used right now */
  34. /*
  35.  * Map from ISO 8859-2 Latin-2 to Windows Code Page 1250
  36.  */
  37. unsigned char cp1250L2[] = {
  38.   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15,
  39.  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,
  40.  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,
  41.  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,
  42.  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,  79,
  43.  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,
  44.  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
  45. 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
  46. 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 169, 139, 166, 171, 174, 172,
  47. 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 185, 155, 182, 187, 190, 188,
  48. 160, 183, 162, 163, 164, 161, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
  49. 176, 177, 178, 179, 180, 181, 182, 183, 184, 177, 186, 187, 165, 189, 181, 191,
  50. 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
  51. 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
  52. 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
  53. 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
  54. };
  55. #endif
  56.  
  57.  
  58. /*----------------------------------------------------------------------
  59.     Return the specified file's contents in a translation array
  60.  
  61.   Args: file name to open
  62.  
  63.   Result: Returns array of unsigned char
  64.  
  65.   ----------------------------------------------------------------------*/
  66. unsigned char *
  67. read_xtable(fname)
  68.     char *fname;
  69. {
  70.     FILE *fp;
  71.     unsigned char *cp;
  72.     int  c, i = 0;
  73.  
  74.     if(fname && (fp = fopen(fname, "r"))){
  75.     cp = (unsigned char *)fs_get(256 * sizeof(unsigned char));
  76.  
  77.     while(fscanf(fp, "%d ", &c) == 1 && i < 256)
  78.       cp[i++] = (unsigned char)c;
  79.  
  80.     fclose(fp);
  81.  
  82.     if(i != 256){        /* table MUST be correct size */
  83.         q_status_message1(SM_ORDER,2,2,"Translation table \"%s\" too small",
  84.                   fname);
  85.         display_message('x');
  86.         fs_give((void **)&cp);
  87.     }
  88.  
  89.     return(cp);
  90.     }
  91.     else
  92.       return(NULL);
  93. }
  94.